package com.vvlive.caibao.smartcity.data;

import com.vvlive.caibao.smartcity.bean.EnterpriseContact;
import com.vvlive.caibao.smartcity.bean.Person;
import com.vvlive.caibao.smartcity.bean.PersonalMeetingBean;
import com.vvlive.caibao.smartcity.utils.RandomUtil;
import com.vvlive.caibao.smartcity.utils.TimeUtil;
import com.vvlive.caibao.smartcity.utils.sort.Name;
import com.vvlive.caibao.smartcity.utils.sort.SortUtil;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * Created by zhj on 2015/6/29.
 * 模拟数据类
 */
public class BaseData {
    public static String[] names = {
            "周杰伦", "林俊杰", "孙燕姿", "蔡依林", "罗大佑", "李宗盛",
            "崔健", "李健", "黄丽玲", "李荣浩", "萧敬腾", "林宥嘉", "邓紫棋",
            "张学友", "郭富城", "王菲"
    };

    public static String[] urls = {
            "http://img4.imgtn.bdimg.com/it/u=2205791892,1328528914&fm=23&gp=0.jpg",
            "http://img5.imgtn.bdimg.com/it/u=2605984149,3031378428&fm=11&gp=0.jpg",
            "http://img1.imgtn.bdimg.com/it/u=1477579747,1739345058&fm=23&gp=0.jpg",
            "http://img4.imgtn.bdimg.com/it/u=3061992131,2556019989&fm=23&gp=0.jpg",
            "http://img4.imgtn.bdimg.com/it/u=2584355946,4148531126&fm=23&gp=0.jpg",
            "http://img4.imgtn.bdimg.com/it/u=2205791892,1328528914&fm=23&gp=0.jpg",
            "http://img5.imgtn.bdimg.com/it/u=2605984149,3031378428&fm=11&gp=0.jpg",
            "http://img1.imgtn.bdimg.com/it/u=1477579747,1739345058&fm=23&gp=0.jpg",
            "http://img4.imgtn.bdimg.com/it/u=3061992131,2556019989&fm=23&gp=0.jpg",
            "http://img4.imgtn.bdimg.com/it/u=2584355946,4148531126&fm=23&gp=0.jpg"
    };

    /**
     * 获取模拟的联系人信息
     * @return
     */
    public static List<EnterpriseContact> getContactData() {
        List<EnterpriseContact> contacts = new ArrayList<EnterpriseContact>();
        EnterpriseContact contact;
        for (int i = 0; i < names.length; i++) {
            contact = new EnterpriseContact();
            contact.setName(names[i]);
            contact.setMood("需求又改了" + i + "次!!!");
            contact.setLastTime(TimeUtil.getCurrentTime("hh:mm"));
            contact.setPortrait(urls[RandomUtil.getRandomNumber(urls.length) - 1]);
            contact.setEmail(names[i] + ":wellwell@okla.com");
            contact.setJob("软件");
            contact.setMobile(RandomUtil.getRandomMobile());
            contact.setMore("暂无更多" + names[i] + "的信息");
            contact.setType("类型" + i);
            contact.setPhone(RandomUtil.getRandomPhone());
            contacts.add(contact);
            contact = null;
        }
        return contacts;
    }

    /**
     * 获取模拟的好友信息
     * @return
     */
    public static List<Person> getPersonData() {
        List<Person> persons = new ArrayList<>();
        Person person = null;
        for (int i = 0; i < names.length; i++) {
            person = new Person();
            person.setName(names[i]);
            person.setNumber("00" + i);
            person.setMobile(RandomUtil.getRandomMobile());
            person.setDepartment("Software");
            person.setPortrait(urls[RandomUtil.getRandomNumber(urls.length) - 1]);
            person.setSex(i % 2 == 0 ? 1 : 0);
            person.setJob("Android");
            persons.add(person);
        }
        return persons;
    }

    public static List<Object> getPagerContacts() {
        List<Object> contacts = new ArrayList<>();
        List<String> namesList = new ArrayList<>();
        for (String name : names) {
            namesList.add(name);
        }
        Map<String, List<Name>> namesMap = SortUtil.getListByGroup(namesList);
        Object[] keys = namesMap.keySet().toArray();
        Arrays.sort(keys);
        for (Object key : keys) {
            contacts.add(key.toString());
            for (Name name : namesMap.get(key)) {
                Person person = new Person();
                person.setName(name.getOriginal());
                person.setNumber("00");
                person.setMobile(RandomUtil.getRandomMobile());
                person.setDepartment("Software");
                person.setPortrait(urls[RandomUtil.getRandomNumber(urls.length) - 1]);
                person.setSex(1);
                person.setJob("Android");
                contacts.add(person);
            }
        }

        return contacts;
    }

    /**
     * 获取模拟的会议信息
     * @param size 要获取的会议数量
     * @return
     */
    public static List<PersonalMeetingBean> getTestMeetings(int size) {
        List<PersonalMeetingBean> meetingBeans = new ArrayList<>();
        for (int i = 0; i < size; i++) {
            PersonalMeetingBean bean = new PersonalMeetingBean();
            bean.setRoom("会议室" + i);
            bean.setTopic("马上开会" + i);
            bean.setTime("2015-10-10_2015-10-10 09:00-10:30");
            meetingBeans.add(bean);
        }
        return meetingBeans;
    }

    /**
     * 获取模拟的会议信息
     * @return
     */
    public static List<PersonalMeetingBean> getTestMeetings() {
        return getTestMeetings(20);
    }


}
